import Main from '@/views/Main.vue';

// 不作为Main组件的子页面展示的页面单独写，如下
export const loginRouter = {
    path: '/login',
    name: 'login',
    meta: {
        title: 'Login - 登录'
    },
    component: resolve => { require(['@/views/login.vue'], resolve); }
};

export const locking = {
    path: '/locking',
    name: 'locking',
    component: resolve => { require(['@/views/main-components/lockscreen/components/locking-page.vue'], resolve); }
};

//作为Main组件的子页面展示但是不在左侧菜单显示的路由写在otherRouter里
export const otherRouter = {
    path: '/',
    name: 'otherRouter',
    redirect: '/home',
    component: Main,
    children: [
        { path: 'home', title: {i18n: 'home'}, name: 'home_index', component: resolve => { require(['@/views/home/home.vue'], resolve); } },
    ]
};

// 作为Main组件的子页面展示并且在左侧菜单显示的路由写在appRouter里
export const appRouter = [
    {
        path: '/list',
        icon: 'clipboard',
        name: 'order',
        title: '订单列表',
        component: Main,
        children: [
            { path: 'list', title: '订单列表', name: 'order_list', component: resolve => { require(['@/views/order/order.vue'], resolve); } },
        ]
    },
    // {
    //     path: '/rbac',
    //     icon: 'android-checkbox',
    //     name: 'rbac',
    //     title: '权限管理',
    //     component: Main,
    //     children: [
    //         { path: 'group', title: '权限组管理', name: 'rbac_group', component: resolve => { require(['@/views/rbac/rbac.vue'], resolve); } },
    //         { path: 'spot', title: '权限点管理', name: 'rbac_spot', component: resolve => { require(['@/views/rbac/rbac.vue'], resolve); } }
    //     ]
    // },
    {
        path: '/project',
        icon: 'android-checkbox',
        name: 'project',
        title: '项目管理',
        component: Main,
        children: [
            { path: 'list', title: '数据列表', name: 'project_list', component: resolve => { require(['@/views/project/list.vue'], resolve); } },
            { path: 'add', title: '新增项目', name: 'project_add', component: resolve => { require(['@/views/project/add.vue'], resolve); } }
        ]
    },
    {
        path: '/service',
        icon: 'android-checkbox',
        name: 'service',
        title: '服务管理',
        component: Main,
        children: [
            { path: 'list', title: '服务内容', name: 'service_list', component: resolve => { require(['@/views/service/list.vue'], resolve); } },
            { path: 'add', title: '新增服务', name: 'service_add', component: resolve => { require(['@/views/service/add.vue'], resolve); } }
        ]
    },
    {
        path: '/field',
        icon: 'android-checkbox',
        name: 'field',
        title: '字段管理',
        component: Main,
        children: [
            { path: 'list', title: '字段内容', name: 'field_list', component: resolve => { require(['@/views/field/list.vue'], resolve); } },
            { path: 'add', title: '新增字段', name: 'field_add', component: resolve => { require(['@/views/field/add.vue'], resolve); } }
        ]
    },
    // {
    //     path: '/poster',
    //     icon: 'android-checkbox',
    //     name: 'poster',
    //     title: '海报管理',
    //     component: Main,
    //     children: [
    //         { path: 'list', title: '海报内容', name: 'poster_list', component: resolve => { require(['@/views/poster/list.vue'], resolve); } },
    //         { path: 'add', title: '模板设置', name: 'poster_add', component: resolve => { require(['@/views/poster/add.vue'], resolve); } }
    //     ]
    // },
    {
        path: '/users',
        icon: 'android-checkbox',
        name: 'users',
        title: '用户管理',
        component: Main,
        children: [
            { path: 'list', title: '用户列表', name: 'users_list', component: resolve => { require(['@/views/users/list.vue'], resolve); } },
            { path: 'update', title: '编辑资料', name: 'users_update', component: resolve => { require(['@/views/users/update.vue'], resolve); } }
            //{ path: 'detail', title: '用户详情', name: 'users_detail', component: resolve => { require(['@/views/users/detail.vue'], resolve); } }
        ]
    },
    {
        path: '/channel',
        icon: 'android-checkbox',
        name: 'channel',
        title: '渠道管理',
        component: Main,
        children: [
            { path: 'list', title: '管理列表', name: 'channel_list', component: resolve => { require(['@/views/channel/list.vue'], resolve); } },
            // { path: 'update', title: '编辑资料', name: 'users_update', component: resolve => { require(['@/views/users/update.vue'], resolve); } }
            //{ path: 'detail', title: '用户详情', name: 'users_detail', component: resolve => { require(['@/views/users/detail.vue'], resolve); } }
        ]
    }
];

// 所有上面定义的路由都要写在下面的routers里
export const routers = [
    loginRouter,
    otherRouter,
    locking,
    ...appRouter,

];
